<template>
  <div>
  
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px"  class="app-container">
  
         <el-form-item label=""  prop="ipaddr" label-width="200px">
        <el-input
          v-model="queryParams.ipaddr"
          placeholder=""
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

        <el-form-item label="" prop="status">

        <el-select v-model="queryParams.status" placeholder="案号搜索"   clearable>
          <el-option value="案号搜索">案号搜索</el-option>
         <el-option value="申请人搜索">申请人搜索</el-option>
        </el-select>

         <el-select v-model="queryParams.status" placeholder="审核状态"   clearable>
            <el-option value="审核状态">审核状态</el-option>
            <el-option value="审批中">审批中</el-option>
            <el-option value="审批通过">审批通过</el-option>
            <el-option value="审批未通过">审批未通过</el-option>
        </el-select>

      </el-form-item>

      <el-form-item>
        <el-button type="primary"   @click="handleQuery"  >检索</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
      </el-form-item>

    </el-form>



    <el-table v-loading="loading" :data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)" style="width: 100%;" class="app-container1" >
      <el-table-column label="编号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="案号" align="center" prop="tokenId" :show-overflow-tooltip="true" /> </el-table-column>
      <el-table-column label="申请人" align="center" prop="userName" :show-overflow-tooltip="true" /> </el-table-column>
      <el-table-column label="减免金额" align="center" prop="deptName" /> </el-table-column>
      <el-table-column label="申请日期" align="center" prop="ipaddr" :show-overflow-tooltip="true" /> </el-table-column>
      <el-table-column label="审批状态" align="center" prop="loginLocation" :show-overflow-tooltip="true" /> </el-table-column>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleForceLogout(scope.row)"
            v-hasPermi="['monitor:online:forceLogout']"
          >强退</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>

<script>
import { list, forceLogout } from "@/api/monitor/online";

export default {
  name: "Online",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 表格数据
      list: [],
      pageNum: 1,
      pageSize: 10,
      // 查询参数
      queryParams: {
        ipaddr: undefined,
        userName: undefined
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询登录日志列表 */
    getList() {
      this.loading = true;
      list(this.queryParams).then(response => {
        this.list = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 强退按钮操作 */
    handleForceLogout(row) {
      this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户？').then(function() {
        return forceLogout(row.tokenId);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("强退成功");
      }).catch(() => {});
    }
  }
};
</script>
<style scoped>
/* .app-container{
border-radius: 3px;
margin: 5px;
 height: 120px;
background-color: white;
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;

} */
/* .app-container1{
width: 100%;
 margin: 5px;
  padding: 20px;
   box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
background-color: white;
} */
.el-select {
  width: 150px; /* 根据需要设置宽度 */
}

</style>

